<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, user-scalable=no" />
    <title>欢迎</title>
	<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="js/common.js"></script>
    <link rel="stylesheet" type="text/css" href="css/login.css">
	<style type="text/css">
		#lcol, body.aclogin .rcol {
		float: left
		}
		body.aclogin .rcol {
		width 545px;
		}
		body.aclogin #error_div strong { line-height: normal; }
	</style>
</head>
<body>
<div class="main">
    <div id="acloginpod">
<div class="acloginform">
		    <div style="padding-left:100px;">开台</div>           
            <fieldset>          
            <label >用户名:</label>
            <input class="textinput" type="text" id="name"  value="100" >
            <label for="primary_email">密码:</label>
            <input class="textinput" type="password" id="pwd"  value="1">
            <label for="ac_password">台号:</label>
            <input class="textinput" type="text" id="table"  value="1" >
            <div style="padding-left:200px">          
            <input type="image" src="images/right_login.png" width="64" height="64"  alt="进入点菜" onclick = "login()" >            
            </div>
			
            </fieldset>
        <div id="loginmsg" style="color:red;padding-top:10px;">&nbsp;</div>
        </div>
      </div>
</div>

   <script> 
	
       function login(){
	    var name= $("#name").val();
		var pwd= $("#pwd").val();
		var table= $("#table").val();
		if(name==""  ){
		 $("#loginmsg").html("工号不能为空");
		 return ;
		}
		if(pwd==""  ){
		 $("#loginmsg").html("密码不能为空");
		 return ;
		}
		if(table==""  ){
		 $("#loginmsg").html("桌号不能为空");
		 return ;
		}
	    getData(locationIndex,"/dcxt/db/initTable.action" ,'uid='+name+'&pwd='+pwd+'&tableId='+table,loading)   ;
	   }
	   
	   function locationIndex(json){
	      var list = json.data;
		   if(!json.success){
		   $("#loginmsg").html(json.data);
		   }else{
		   if(json.next=="0") {
		     //是否加菜
			 $("#loginmsg").html("餐桌未结账，是否继续<button onclick='goindex()'>加菜</button><button onclick='cancle()'>取消</button>");
		   }else{
		     location.href="list.html?uid="+$("#name").val()+"&tableId="+$("#table").val();
			 }
		   } 
	   }
     
	 function goindex(){
	 location.href="list.html?uid="+$("#name").val()+"&tableId="+$("#table").val();	  
	 }
	 
	 function cancle(){	
	 $("#loginmsg").html("");
	 }
	 
	 function loading(){	 
	     $("#loginmsg").html("<img  src='images/loading.gif'  />");
	 
	 }


   </script>
  
</body>
</html>

